import http from "./http";


//#region 稿件部分

//获取稿件信息列表
export const GetAllWorkInfoList = () => {
  return http.post("/getAllWorkListForAdmin");
};

export const GetWorkInfoList = () => {
  return http.post("/getWorkListForAdmin");
};

/**
 * @description 下架视频
 * @param {vid} 视频id
 */
export const OffShelfWork = (vid) => {
  console.log(vid);
  let body = {
    id: vid,
  };
  return http.post("/AdminDeleteWork", vid, http.CONTENT_TYPE.JSON);
};

/**
 * @description 稿件审核
 * @param {{id,result}} 稿件id和审核结果
 */
export const AuditWork = (wid, result) => {
  let body = {
    wid: wid,
    result: result,
  };
  return http.post("/auditWork", body, http.CONTENT_TYPE.JSON);
};

//获取所有动态
export const GetTrendInfos = () => {
  return http.post("/getAllDynamic");
};

/**
 * 审核动态
 * @param {{id,result}} 动态id和处理结果
 */
export const AuditTrend = (id) => {
  return http.post("/deleteDynamicForAdmin",id,http.CONTENT_TYPE.JSON);
};

//#endregion

//#region 登录相关
/**
 * 管理员登录
 * @param {{account,password}} 账号密码
 */
export const AdminLogin = (account, password) => {
  let body = {
    username: account,
    password: password,
  };
  return http.postUrlEncoded("/login", body);
};
//#endregion

//#region 用户相关
export const GetAllUser = () => {
  return http.post("/getUserList");
};

/**
 * @description 处理异常用户
 * @param {{id,result}} 用户id和处理结果
 */
export const HandleUser = (id, result) => {
  let body = {
    id: id,
    status: result,
  };
  return http.post("/changeUserStatus", body, http.CONTENT_TYPE.JSON);
};
//#endregion


//获取统计信息
export const GetStatics=()=>{
  //TODO:改实际接口地址
    return http.post('/getStatics')
}